package com.ruoyi.project.system.file.service.impl;

import javax.annotation.Resource;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ruoyi.common.utils.uniquekey.IdGererateFactory;
import com.ruoyi.project.system.file.mapper.UploadFileMapper;
import com.ruoyi.project.system.file.domain.UploadFile;
import com.ruoyi.project.system.file.service.IUploadFileService;
import com.ruoyi.common.utils.text.Convert;

/**
 * 资源文件Service业务层处理
 * 
 * @author LCL
 * @date 2020-06-06
 */
@Service
public class UploadFileServiceImpl implements IUploadFileService 
{
    @Resource
    private IdGererateFactory idGererateFactory;
    @Autowired
    private UploadFileMapper uploadFileMapper;

    /**
     * 查询资源文件
     * 
     * @param id 资源文件ID
     * @return 资源文件
     */
    @Override
    public UploadFile selectUploadFileById(String id)
    {
        return uploadFileMapper.selectUploadFileById(id);
    }

    /**
     * 查询资源文件列表
     * 
     * @param uploadFile 资源文件
     * @return 资源文件
     */
    @Override
    public List<UploadFile> selectUploadFileList(UploadFile uploadFile)
    {
        return uploadFileMapper.selectUploadFileList(uploadFile);
    }

    /**
     * 新增资源文件
     * 
     * @param uploadFile 资源文件
     * @return 结果
     */
    @Override
    public int insertUploadFile(UploadFile uploadFile)
    {
        uploadFile.setId(this.idGererateFactory.nextStringId());
        return uploadFileMapper.insertUploadFile(uploadFile);
    }

    /**
     * 修改资源文件
     * 
     * @param uploadFile 资源文件
     * @return 结果
     */
    @Override
    public int updateUploadFile(UploadFile uploadFile)
    {
        return uploadFileMapper.updateUploadFile(uploadFile);
    }

    /**
     * 删除资源文件对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteUploadFileByIds(String ids)
    {
        return uploadFileMapper.deleteUploadFileByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除资源文件信息
     * 
     * @param id 资源文件ID
     * @return 结果
     */
    @Override
    public int deleteUploadFileById(String id)
    {
        return uploadFileMapper.deleteUploadFileById(id);
    }

    @Override
    public int deleteUploadFileByRealPaths(List delRealPaths) {
        return uploadFileMapper.deleteUploadFileByRealPaths(delRealPaths);
    }

    @Override
    public int updateUploadFileByRealPaths(List addRealPaths, UploadFile uploadFile) {
        return uploadFileMapper.updateUploadFileByRealPaths(addRealPaths,uploadFile);
    }

	@Override
	public List<UploadFile> selectGarbageData() {
		return uploadFileMapper.selectGarbageData();
	}

	@Override
	public int deleteGarbageData() {
		return uploadFileMapper.deleteGarbageData();
	}
}
